package com.ruoyi.shop.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.shop.mapper.OrdersGoodsMapper;
import com.ruoyi.shop.domain.OrdersGoods;
import com.ruoyi.shop.service.IOrdersGoodsService;

/**
 * 订单详情Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-11
 */
@Service
public class OrdersGoodsServiceImpl implements IOrdersGoodsService 
{
    @Autowired
    private OrdersGoodsMapper ordersGoodsMapper;

    /**
     * 查询订单详情
     * 
     * @param id 订单详情主键
     * @return 订单详情
     */
    @Override
    public OrdersGoods selectOrdersGoodsById(Long id)
    {
        return ordersGoodsMapper.selectOrdersGoodsById(id);
    }

    /**
     * 查询订单详情列表
     * 
     * @param ordersGoods 订单详情
     * @return 订单详情
     */
    @Override
    public List<OrdersGoods> selectOrdersGoodsList(OrdersGoods ordersGoods)
    {
        return ordersGoodsMapper.selectOrdersGoodsList(ordersGoods);
    }

    /**
     * 新增订单详情
     * 
     * @param ordersGoods 订单详情
     * @return 结果
     */
    @Override
    public int insertOrdersGoods(OrdersGoods ordersGoods)
    {
        ordersGoods.setCreateTime(DateUtils.getNowDate());
        return ordersGoodsMapper.insertOrdersGoods(ordersGoods);
    }

    /**
     * 修改订单详情
     * 
     * @param ordersGoods 订单详情
     * @return 结果
     */
    @Override
    public int updateOrdersGoods(OrdersGoods ordersGoods)
    {
        ordersGoods.setUpdateTime(DateUtils.getNowDate());
        return ordersGoodsMapper.updateOrdersGoods(ordersGoods);
    }

    /**
     * 批量删除订单详情
     * 
     * @param ids 需要删除的订单详情主键
     * @return 结果
     */
    @Override
    public int deleteOrdersGoodsByIds(Long[] ids)
    {
        return ordersGoodsMapper.deleteOrdersGoodsByIds(ids);
    }

    /**
     * 删除订单详情信息
     * 
     * @param id 订单详情主键
     * @return 结果
     */
    @Override
    public int deleteOrdersGoodsById(Long id)
    {
        return ordersGoodsMapper.deleteOrdersGoodsById(id);
    }
    @Override
    public void cancelOrder(String orderId)
    {
        ordersGoodsMapper.cancelOrder(orderId);
    }
}
